<?php
namespace Modules\Backend\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class AdminLoginRequest extends FormRequest
{

    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        switch (strtolower($this->method())){
            case "post":
                return [
                    "user_name" => 'required|min:5|max:30',
                    'password' => 'required|min:6',
                ];
            default:
                return [];
        }

    }


    public function messages()
    {
        return [
            'user_name.required' => '管理员用户名必须填写',
            'user_name.min' => '管理员用户名长度为5到30位',
            'user_name.max' => '管理员用户名长度为5到30位',
            'password.required' => '管理员密码必须填写',
            'password.min' => '管理员密码最短6位',
        ];
    }



}
